package com.example.sso.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @author dangwen1
 * @date 2022年01月19日 18:49
 * @description
 */
@Controller
public class LoginController {

    @PostMapping("login")
    public String login(HttpServletRequest request){
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        if("dangwen".equals(username) && password.equals("123456")){
            return "index";
        }
        return "login";
    }

    @GetMapping("index")
    public String index(){
        return "login";
    }
}
